<template>
  <div class="info">
    <el-table :data="tableData" style="width: 100%" v-if="tableData.length">
      <el-table-column label="教学楼编号" prop="buildId"></el-table-column>
      <el-table-column label="楼层" prop="storey"></el-table-column>

      <el-table-column label="教室编号" prop="roomId"></el-table-column>
      <el-table-column label="申请时间" prop="applyTime"></el-table-column>
      <el-table-column label="预约时间" prop="appointTime"></el-table-column>
      <el-table-column label="状态" prop="state">
        <template slot-scope="scope">{{scope.row.state|State}}</template>
      </el-table-column>
    </el-table>

    <div v-else class="kong">
      <img src="../assets/container-nodata-icon.svg" />
      <br />暂无数据，请新增
    </div>
  </div>
</template>


<script>
export default {
  data() {
    return {
      tableData: [],
    };
  },
  created() {
    this.getApplyInfo();
  },

  filters: {
    State(key) {
      switch (key) {
        case "0":
          return "待审核";
        case "1":
          return "审核通过";
        case "2":
          return "审核拒绝";
      }
    },
  },

  methods: {
    getApplyInfo() {
      this.$axios({
        url: "/api/applyInforQ",
        method: "post",
        data: {
          id: String(JSON.parse(sessionStorage.getItem("userInfo")).id),
        },
      }).then((res) => {
        if (res._RejCode === "00000000") {
          this.tableData = res.applyInfors;
        }
      });
    },
  },
};
</script>
<style  scoped>
.kong {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.kong > img {
  width: 500px;
}
</style>
